//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package test.集合.点名;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Random;
import java.util.Scanner;

public class 点名3 {
    static List<String> callTheRoll = new ArrayList();

    public 点名3() {
    }

    public static void main(String[] args) {
        List<String> strs = new ArrayList();
        Collections.addAll(strs, new String[]{"man1", "man2", "man3", "man4", "man5", "man6", "woman1", "woman2", "woman3", "woman4"});

        Scanner sc;
        do {
            System.out.println(demo(strs));
            System.out.println("是否继续点名(N退出/任意键继续):");
            sc = new Scanner(System.in);
        } while(!Objects.equals(sc.nextLine(), "N"));

    }

    public static String demo(List<String> strs) {
        if (callTheRoll == null || callTheRoll.isEmpty()) {
            System.out.println("开始新的循环");
            callTheRoll.addAll(strs);
        }

        Random rm = new Random();
        int index = rm.nextInt(callTheRoll.size());
        String out = (String)callTheRoll.get(index);
        callTheRoll.remove(callTheRoll.get(index));
        return out;
    }
}
